import os
from tkinter import *
from tkinter import Menu

from CommonOperations.init_setting_dir_path import init_setting_dir_path


class StartWindow(Frame):
    """初始窗口"""
    def __init__(self, master):
        self.root = master
        self.root.config()
        self.root.title("图片生成小工具")
        self.root.geometry(f"500x400+100+100")

        super(StartWindow, self).__init__(master)
        self.root.grid()

        menubar = Menu(self.root)
        menu1 = Menu(menubar, tearoff=False)
        menu1.add_command(label="批量生成数据", command=self.jump_to_batch_images_window)
        menubar.add_cascade(label="更多功能", menu=menu1)

        from PageFrames.create_new_img_frame import CreateNewImageFrame

        CreateNewImageFrame(self.root)

        self.root.config(menu=menubar)

    def jump_to_batch_images_window(self):
        """单独打开操作窗口"""
        create_imgs_with_file_window = Tk()
        create_imgs_with_file_window.config()
        create_imgs_with_file_window.title("批量生成图片")
        create_imgs_with_file_window.geometry("400x400")

        from PageFrames.create_imgs_with_file import CreateImgsWithFile
        CreateImgsWithFile(create_imgs_with_file_window)

if __name__ == "__main__":
    init_setting_dir_path()

    root1 = Tk()
    app1 = StartWindow(root1)
    app1.mainloop()


